<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/pages/common/header.jsp"%>
<html>
	<head>
		<script src="${jsContext}/jquery/jquery.dataTables.js" type="text/javascript"></script>
		<script src="${jsContext}/jquery/TableTools.js" type="text/javascript"></script>
		<script src="${jsContext}/jquery/ZeroClipboard.js" type="text/javascript"></script>
	
		<script type="text/javascript">		
			jQuery(document).ready(function() {
				jQuery('#allProdinfo').dataTable( {
					"bPaginate"      : true,
			        "sPaginationType": "full_numbers",// PaginationType:1.full_numbers 2. two_buttons
			        "aoColumns": [
						{ "sWidth":"10%"},
						{ "sWidth":"25%"},
						{ "sWidth":"20%"},
						{ "sWidth":"10%","bSortable": false},
						{ "sWidth":"15%","bSortable": false},
					],
					/* "aaSorting": [[ 0, "desc" ]] , */
				});
			 });
		</script>
		<script type="text/javascript">
			function addStockPopup(prodId,preStock,prodName){
				var hiddenInput=document.getElementById("hiddenInputs");
				hiddenInput.innerHTML='<input type="hidden" name="prodName" value="'+prodName+'"><input type="hidden" name="prevStock" value="'+prodName+'"><input type="hidden" name="prodId" value="'+prodName+'">'
				
				document.getElementById("prodName").innerHTML=prodName;
				document.getElementById("prevStock").innerHTML=preStock;
				ShowModalPopup('dvPopup');
			}
		
		</script>
	</head>
	<body class="mainbody">
		<c:set var="productList" value="${requestScope.productList}"/>
		<div class="mainContainer">
			<section class="bodyContainer">
				<div class="productReport">
        			<h2 class="titleTxtBig">Stock Report</h2>
            		<p class="hrlineBr"></p>

        			<div class="productDtls">       
			            <p class="spacerTopTen"></p>
			            
         				<div class="divclear">
         					<table cellpadding="0" cellspacing="0" border="0" class="display reportTable" id="allProdinfo" style="width:961px">
								<thead>
									<tr>
										<th>Sr.No.</th>
										<th>Name</th>
										<th>Product Code</th>
										<th>Stock</th>
										<th>Add Stock</th>
										
									</tr>
								</thead>
								<tbody>
									<c:if test="${stock ne null}">
										<c:forEach var="stock" items="${stock}" varStatus="counter">
											<tr>
											    <td><c:out value="${counter.count}"/></td>
												<td><c:out value="${stock[1]}"/></td>
												<td><c:out value="${stock[2]}"/></td>
												<td><c:out value="${stock[3]}"/></td>
												<%-- <td><a href="${context}/jewel/pages/addStock.jsp?prodId=${stock[0]}&&prodName=${product.prodName}">Add</a></td> --%>
												<td><a  onclick="addStockPopup('${stock[0]}','${stock[3]}','${stock[1]}')">Add</a></td>
											</tr>
										</c:forEach>
									</c:if>
								</tbody>
							</table>
         				</div>
	         			<p class="spacerTopTen"></p>
		            	<p class="hrlineBr"></p>
		            	<p class="spacerTopTen"></p>
     				</div>           	        
				</div>
 			</section>
 			<div id="dvPopup">
				<span class="closeBtn"> <a href="#" onclick="HideModalPopup('dvPopup'); return false;"><img src="${imageContext}/cross.png"></a></span>
			    <div class="popheadingBgDiv">
			    	<h2 class="popTitleTxtBig">Change Stock</h2>
			        <!-- <p class="popPrintButtonDiv"><a href="">Print</a></p> -->
			  	</div>
			  	<div id="hiddenInputs">
			  		<input type="hidden" name="prodName" value="">
			  		<input type="hidden" name="prevStock" value="">
			  		<input type="hidden" name="prodId" value="">
			  	</div>
				<div class="orderStatusTxt">Change Product Stock </div>
			    <p class="spacerTopTen"></p>
			    <p class="spacerTopTen"></p>
			    <div class="omsRemarkStatus">
			    	<div class="divclear">
		            	<span class="omsloginlabel">Product Name : </span>
		                <span class="omslogininputFld"><div id="prodName"></div></span>
		            </div>
		            <div class="divclear">
		            	<span class="omsloginlabel">Previous Stock : </span>
		                <span class="omslogininputFld"><div id="prevStock"></div></span>
		            </div>
		            
		        	<div class="divclear">
		            	<span class="omsloginlabel">Change Stock : </span>
		                <span class="omslogininputFld"><input type="text" name="ChangeStock" class="omsloginfld"></span>
		            </div>
		            
		            <p class="spacerTopTen"></p>
		            <p class="spacerTopTen"></p>
		            <div class="divclear">
	                   <span class="loginlabel"></span>
	                   <span class="buttonSiyora"><a href="">Update Status</a></span>
		       		</div>
		      	</div>	
			</div>
 		</div>
		<jsp:include page="/pages/common/footer.jsp" />
	</body>
</html>